package utils;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public enum COLOR {
    BLACK       ("§0", "&0"),//黑色
    WHITE       ("§f", "&f"),//白色
    GRAY        ("§7", "&7"),//灰色
    DEEP_GRAY   ("§8", "&8"),//深灰
    DARK        ("§8", "&8"),//暗灰
    BLUE        ("§9", "&9"),//蓝色
    DEEP_BLUE   ("§1", "&1"),//深蓝
    OCEAN       ("§1", "&1"),//海蓝
    GREEN       ("§a", "&a"),//绿色
    DEEP_GREEN  ("§2", "&2"),//深绿
    LEAVES      ("§2", "&2"),//叶绿
    CYAN        ("§b", "&b"),//青色
    DEEP_CYAN   ("§3", "&3"),//深青
    AQUA        ("§3", "&3"),//水色
    RED         ("§c", "&c"),//红色
    DEEP_RED    ("§4", "&4"),//深红
    BLOOD       ("§4", "&4"),//血色
    PINK        ("§d", "&d"),//粉色
    DEEP_PINK   ("§5", "&5"),//深粉
    PURPLE      ("§5", "&5"),//紫色
    YELLOW      ("§e", "&e"),//黄色
    GOLD        ("§e", "&e"),//金色
    ORANGE      ("§6", "&6"),//橘色
    MAGIC       ("§k", "&k"),//随机字符
    RANDOM      ("§k", "&k"),//随机字符
    BOLD        ("§l", "&l"),//粗体
    STRIKE      ("§m", "&m"),//删除线
    DELLINE     ("§m", "&m"),//删除线
    UNDERLINE   ("§n", "&n"),//下划线
    ITALLIC     ("§o", "&o"),//斜体
    RESET       ("§r", "&r"),//重设
    DEFAULT     ("§r", "&r"),//默认
    ;

    public static List<Map> getAll(){
        List<Map> result=new LinkedList<>();
        for (COLOR e : COLOR.values()){
            Map<String,String> map=new HashMap<>();
            map.put("value",e.getValue());
            map.put("text",e.getText());
            result.add(map);
        }
        return result;
    }
    public static COLOR getName(String value) {
        if (value != null && value != "")
            for (COLOR c : COLOR.values())
                if (value.equals(c.getValue()))
                    return c;
        return null;
    }

    private String value;
    private String text;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    COLOR(String value, String text) {
        this.value = value;
        this.text = text;
    }
}
